import axios from "axios";

// 定义一个常量来保存统一的url
const  baseUrl = "http://localhost:8080";
/**
 * home组件中请求数据的对象
 * @type {{}}
 */
const projectRequest={

    /**
     * 通过id加载project
     * @param projectId
     * @param callBack
     */
    getProjectById(projectId,callBack){
        axios.get(baseUrl + "/project/get?projectId=" + projectId)
            .then(res=>callBack(res.data));
    },getProjectNum(projectId,callBack){
        axios.get(baseUrl + "/project/projectNum?projectId=" + projectId)
        .then(res=>callBack(res.data));
    },getMyProjectNum(userId,callBack){
        let url = baseUrl + '/project/myProjectNum?userId='+userId.value;
        console.log(userId.value);
        axios.get(url)
        .then(res=>callBack(res.data));
    }
}
// 将projectRequest暴露出去
export default projectRequest;